package org.jing.ext.sftp;

import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.SftpATTRS;
import org.jing.core.lang.data.BaseDto;

/**
 * Description: <br>
 *
 * @author bks <br>
 * @since 2021-02-03 <br>
 */
@SuppressWarnings({ "WeakerAccess", "unused" }) public class SftpFile extends BaseDto {
    private String fileName;

    private String longFileName;

    private SftpATTRS fileAttributes;

    public SftpFile() {}

    public static SftpFile parse(ChannelSftp.LsEntry entry) {
        SftpFile file = new SftpFile();
        file.fileName = entry.getFilename();
        file.longFileName = entry.getLongname();
        file.fileAttributes = entry.getAttrs();
        return file;
    }

    public String getFileName() {
        return fileName;
    }

    public SftpFile setFileName(String fileName) {
        this.fileName = fileName;
        return this;
    }

    public String getLongFileName() {
        return longFileName;
    }

    public SftpFile setLongFileName(String longFileName) {
        this.longFileName = longFileName;
        return this;
    }

    public SftpATTRS getFileAttributes() {
        return fileAttributes;
    }

    public SftpFile setFileAttributes(SftpATTRS fileAttributes) {
        this.fileAttributes = fileAttributes;
        return this;
    }
}
